package com.hnchances.grade.common.valid;

import lombok.extern.slf4j.Slf4j;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

@Slf4j
public class PhoneNumberConstraintValidator implements ConstraintValidator<PhoneNumberValid, String> {


    /**
     * 电话号码的合法性校验
     * @param phoneNumber
     * @param constraintValidatorContext
     * @return
     */
    @Override
    public boolean isValid(String phoneNumber, ConstraintValidatorContext constraintValidatorContext) {
        log.info("开始校验数据");
        return phoneNumber.length() == 11;
    }

}
